﻿namespace WebOptimizer.Net.Services.V1
{
	public partial class Task : global::Sidvall.Data.ServiceDataRowBase, global::WebOptimizer.Data.ITask
	{
		#region Public Members

		#region IsEnabled

		private bool _IsEnabled;
		public bool IsEnabled
		{ 
			get
			{
				return _IsEnabled;
			}
			set
			{
				_IsEnabled = value;
			}
		}

		#endregion
		#region Path

		private string _Path;
		public string Path
		{ 
			get
			{
				return _Path;
			}
			set
			{
				_Path = value;
			}
		}

		#endregion
		#region TaskId

		private System.Nullable<int> _TaskId;
		public System.Nullable<int> TaskId
		{ 
			get
			{
				return _TaskId;
			}
			set
			{
				_TaskId = value;
			}
		}

		#endregion
		#region TaskTypeId

		private global::WebOptimizer.Data.TaskType _TaskTypeId;
		public global::WebOptimizer.Data.TaskType TaskTypeId
		{ 
			get
			{
				return _TaskTypeId;
			}
			set
			{
				_TaskTypeId = value;
			}
		}

		#endregion
		#region IsDirty

		protected override bool IsDirty
		{
			get
			{
				return global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.IsDirty(this);
			}
		}

		#endregion
		
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
		public SourceCollection Sources { get; set; }
		#region LoadInstanceField

		public void LoadInstanceField(global::WebOptimizer.Data.Fields.TaskField fieldId, object value, bool cascade)
		{
			global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.LoadInstanceField(this, fieldId, value, cascade, false, false);
		}
		public void LoadInstanceField(string fieldName, object value, bool cascade)
		{
			global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.LoadInstanceField(this, fieldName, value, cascade, false, false);
		}

		#endregion
		#region Copy

		public Task Copy()
		{
			return global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.Copy(this) as Task;
		}
		public Task Copy(Sidvall.Data.CopySettings settings)
		{
			return global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.Copy(this, settings) as Task;
		}

		#endregion
		#region Import

		public void Import(global::WebOptimizer.Data.ITask item)
		{
			global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.Import(this, item);
		}
		public void Import(global::WebOptimizer.Data.ITask item, Sidvall.Data.CopySettings settings)
		{
			global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.Import(this, item, settings);
		}

		#endregion
		#region Validate

		public Sidvall.Data.BrokenRuleCollection Validate()
		{
			return global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.Validate(this);
		}
		public Sidvall.Data.BrokenRuleCollection Validate(Sidvall.Data.ValidationSettings settings)
		{
			return global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.Validate(this, settings);
		}

		#endregion

		#region ITask Members

		bool global::WebOptimizer.Data.ITask.IsEnabled
		{
			get
			{
				return this._IsEnabled;
			}
			set
			{
				this._IsEnabled = value;
			}
		}
		string global::WebOptimizer.Data.ITask.Path
		{
			get
			{
				return this._Path;
			}
			set
			{
				this._Path = value;
			}
		}
		System.Nullable<int> global::WebOptimizer.Data.ITask.TaskId
		{
			get
			{
				return this._TaskId;
			}
			set
			{
				this._TaskId = value;
			}
		}
		global::WebOptimizer.Data.TaskType global::WebOptimizer.Data.ITask.TaskTypeId
		{
			get
			{
				return this._TaskTypeId;
			}
			set
			{
				this._TaskTypeId = value;
			}
		}
		System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ISource> global::WebOptimizer.Data.ITask.Sources
		{
			get
			{
				return this.Sources;
			}
			set
			{
				this.Sources = value as SourceCollection;
			}
		}

		#endregion

		#endregion
		#region Constructors

		public Task()
		{
		}

		public Task(bool initializeDefaultValues)
			: this(initializeDefaultValues, null)
		{
		}

		public Task(bool initializeDefaultValues, Sidvall.Data.DataRowState? dataRowState)
			: base(dataRowState)
		{
			if (initializeDefaultValues)
				global::WebOptimizer.SystemContext.Current.EntityFacade.TaskManager.InitializeDefaultValues(this);
		}

		#endregion
	}
}